        document.getElementById('registerForm').addEventListener('submit', function(e) {
            e.preventDefault();
            const username = document.getElementById('reg-username').value;
            const email = document.getElementById('reg-email').value;
            const password = document.getElementById('reg-password').value;
            const confirmPassword = document.getElementById('reg-confirm-password').value;
            const agreeTerms = document.getElementById('agree-terms').checked;
            
            // 验证
            if(!username || !email || !password || !confirmPassword) {
                alert('请填写所有必填字段');
                return;
            }
            
            if(password !== confirmPassword) {
                alert('两次输入的密码不一致');
                return;
            }
            
            if(!agreeTerms) {
                alert('请同意服务条款和隐私政策');
                return;
            }
            
            // 显示成功提示
            const alertBox = document.getElementById('successAlert');
            alertBox.style.display = 'block';
            
            // 3秒后跳转到登录页面
            setTimeout(() => {
                window.location.href = 'index.html';
            }, 3000);
        });
		// 获取提交申请按钮元素
		const submitButton = document.getElementById('submit-application');
		
		// 为按钮添加点击事件监听器
		submitButton.addEventListener('click', function (event) {
		    // 阻止按钮的默认跳转行为
		    event.preventDefault();
		    // 跳转到指定页面，这里假设跳转到 target-page.html
		    window.location.href = 'chat.html';
		});